create or replace trigger DRS_LDCOM_RELATION_i_trig
  before insert on DRS_LDCOM_RELATION
  for each row
declare
  -- local variables here
  v_trigger_user  varchar2(100);
  v_trigger_date  date;
  v_sqlcode       varchar2(6);
  v_sqlerrm       varchar2(200);
  v_error_comment varchar2(300);
begin
  v_error_comment := 'before get_user';
  v_trigger_user  := user;
  v_trigger_date  := sysdate;
  :new.FCU        := v_trigger_user;
  :new.FCD        := v_trigger_date;
  :new.LCU        := v_trigger_user;
  :new.LCD        := v_trigger_date;
  SELECT DRS_LDCOM_RELATION_ID_SEQ.NEXTVAL INTO :NEW.PK_SERIAL# FROM DUAL;
exception
  when others then
    v_sqlcode := sqlcode;
    v_sqlerrm := substr(sqlerrm, 1, 200);

    INSERT INTO drs_error_log
      (error_no,
       error_message,
       trigger_name,
       trigger_user,
       trigger_date,
       error_comment
       )
    VALUES
      (v_sqlcode,
       v_sqlerrm,
       'DRS_LDCOM_RELATION_i_trig',
       v_trigger_user,
       v_trigger_date,
       v_error_comment);

end DRS_LDCOM_RELATION_i_trig;
/
create or replace trigger DRS_LDCOM_RELATION_u_trig
  before update on DRS_LDCOM_RELATION
  for each row
declare
  -- local variables here
v_trigger_user  varchar2(100);
  v_trigger_date  date;
  v_sqlcode       varchar2(6);
  v_sqlerrm       varchar2(200);
  v_error_comment varchar2(300);
begin
  v_error_comment := 'before get_user';
  v_trigger_user  := user;
  v_trigger_date  := sysdate;
  :new.LCU        := v_trigger_user;
  :new.LCD        := v_trigger_date;
exception
  when others then
    v_sqlcode := sqlcode;
    v_sqlerrm := substr(sqlerrm, 1, 200);

    INSERT INTO drs_error_log
      (error_no,
       error_message,
       trigger_name,
       trigger_user,
       trigger_date,
       error_comment
       )
     VALUES
      (v_sqlcode,
       v_sqlerrm,
       'DRS_LDCOM_RELATION_u_trig',
       v_trigger_user,
       v_trigger_date,
       v_error_comment);
end DRS_LDCOM_RELATION_u_trig;
/